import ajax from '@/api/ajax'

const { url } = require("../../build/config");

// console.log(config)

//  url.base_url;
const base_url = `${url.base_url}/api/user`

export function userPage(data) {
  return ajax({
    url: `${base_url}/page`,
    method: 'POST',
    data: data,
  })
}

export function getCurrentUserInfo() {
  return ajax({
    url: `${base_url}`,
    method: 'get',
  })
}

export function userDelete(key) {
  return ajax({
    url: `${base_url}/${key}`,
    method: 'delete',
    showMsg: true,
  })
}

export function userAdd(data) {
  return ajax({
    url: `${base_url}`,
    method: 'post',
    data: data,
    showMsg: true,
  })
}

export function getUserInfo(key) {
  return ajax({
    url: `${base_url}/${key}`,
    method: 'get',
  })
}

export function userUpdate(data) {
  return ajax({
    url: `${base_url}`,
    method: 'put',
    data: data,
    showMsg: true,
  })
}

export function changePassword(data) {
  return ajax({
    url: `${base_url}/password`,
    method: 'post',
    data: data,
    showMsg: true,
  })
}

export function changeCurrentUser(data) {
  return ajax({
    url: `${base_url}/current`,
    method: 'put',
    data: data,
    showMsg: true,
  })
}




